feat: basic fuzzing protection for model name and ios, android tokens - #217
Merged
Conversation
noahpodgurski
approved these changes
Jul 29, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Reject fuzzing/injection payloads on model, App Attest key_id_b64, and Play Integrity integrity_token before they cost a DB round trip or an external API call.
We were seeing scanner traffic (SQLi, XSS, code injection) landing in these free-text fields. None of it can actually do anything to this stack, but it still triggers a DB query or an external call (LiteLLM, Google Play Integrity) before getting rejected downstream.
Added plain charset + length checks, no whitelist to maintain:
All garbage still gets a 400, just without the round trip.
QA
Unit tests table-driven over real model names / real-shaped tokens (should pass) and the sampled attack payloads (should reject), plus edge cases (empty, over length, bad edge chars). Integration tests confirm the downstream call (_decode_integrity_token, env.valid_service_type_for_model, fxa_auth) is never reached for rejected input, not just that the response is a 400.